Skip to content

feat: Propagate W3C + Sentry headers in Sentry.OpenTelemetry.Exporter#5217

Closed
jamescrosswell wants to merge 1 commit into
mainfrom
fix/5210-w3c-propagator-default
Closed

feat: Propagate W3C + Sentry headers in Sentry.OpenTelemetry.Exporter#5217
jamescrosswell wants to merge 1 commit into
mainfrom
fix/5210-w3c-propagator-default

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes #5210

Summary

  • The default TextMapPropagator used by AddSentryOtlpExporter (and UseOtlp) was previously SentryPropagator, meaning only sentry-trace and baggage headers were propagated out of the box.
  • This PR changes the default to a CompositeTextMapPropagator containing both TraceContextPropagator (W3C traceparent/tracestate) and SentryPropagator (sentry-trace + baggage).
  • Users who pass a custom defaultTextMapPropagator are unaffected — the new default only applies when no propagator is supplied.

🤖 Generated with Claude Code

… in Sentry.OpenTelemetry.Exporter

Fixes #5210

Resolves the adoption footgun where the OOTB default was Sentry-only
propagation. The default is now a CompositeTextMapPropagator that includes
both TraceContextPropagator (W3C traceparent/tracestate) and SentryPropagator
(sentry-trace + baggage), enabling out-of-the-box interoperability with
services that use standard W3C trace context headers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamescrosswell jamescrosswell changed the title feat(opentelemetry): use W3C + Sentry composite propagator by default in Sentry.OpenTelemetry.Exporter feat: Propagate W3C + Sentry headers in Sentry.OpenTelemetry.Exporter May 11, 2026
@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.17%. Comparing base (80f7ff5) to head (5ed716e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5217      +/-   ##
==========================================
+ Coverage   74.13%   74.17%   +0.03%     
==========================================
  Files         506      506              
  Lines       18292    18296       +4     
  Branches     3576     3576              
==========================================
+ Hits        13561    13571      +10     
+ Misses       3859     3854       -5     
+ Partials      872      871       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell marked this pull request as ready for review May 11, 2026 06:04
@jamescrosswell jamescrosswell requested a review from Flash0ver as a code owner May 11, 2026 06:04
@ericsampson

Copy link
Copy Markdown
Contributor

Thank you sir 🫡

}

defaultTextMapPropagator ??= new SentryPropagator();
defaultTextMapPropagator ??= new CompositeTextMapPropagator(new TextMapPropagator[]

@Flash0ver Flash0ver Jun 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: propagateTraceparent option

Should this option be guarded by the SentryOptions.PropagateTraceparent?
Is this a preceding oversight? Or should

Note: This option is currently only used in the base SentryMessageHandler (derived: SentryHttpMessageHandler and SentryGraphQLHttpMessageHandler)

@Flash0ver Flash0ver Jun 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow-up question: docs

In the docs we mention

The following SDKs support the propagateTraceparent option:
see https://docs.sentry.io/concepts/otlp/sentry-with-otel/

Should we list .NET there too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this option be guarded by the SentryOptions.PropagateTraceparent? Is this a preceding oversight? Or should

Note: This option is currently only used in the base SentryMessageHandler (derived: SentryHttpMessageHandler and SentryGraphQLHttpMessageHandler)

Hm, interesting question. According to the docs:

The integration MUST NOT set up an automatic propagator. Cross-service trace propagation is handled by the propagateTraceparent setting or by user-configured OTel propagators. How to set up an OTel propagator is a documentation concern.

So even the previous behaviour we had doesn't seem consistent with the docs. When using OTLP, presumably users can and should configure the propagators via OTEL (not Sentry):

@ericsampson this is a bit different to what you were expecting... but it's also how all of our other OTLP integrations behave so I don't think we have much wiggle room on this one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamescrosswell

Copy link
Copy Markdown
Collaborator Author

We shouldn't actually be implementing this. See:

@Flash0ver Flash0ver deleted the fix/5210-w3c-propagator-default branch June 23, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentry.OpenTelemetry.Exporter should accept and propagate both Sentry and W3C headers by default

3 participants